<template>
    <div class="export-exam-paper-dialog">
        <p>确定导出试卷吗？</p>
        <el-radio-group v-model="exportType">
            <el-radio :label="1">导出试题</el-radio>
            <el-radio :label="2">导出试题+答案</el-radio>
            <el-radio :label="3">导出试题+答案+解析</el-radio>
        </el-radio-group>
        <el-row class="verifyidentity-button">
            <el-button @click.stop="closeFun" round>取消</el-button>
            <el-button type="primary" @click="handlerExport" round>确定</el-button>
        </el-row>
    </div>
</template>
<script>
export default {
    name: 'ExportExamPaper',
    props: {
        closeFun: {
            type: Function,
            required: true
        },
        oldInfo: {
            type: Object,
            default () {
                return {}
            }
        }
    },
    data() {
        return {
            exportType: 1
        }
    },
    created() {

    },
    methods: {
        handlerExport() {
            let parames = {
                id: this.oldInfo.id, // 试卷id
                exportType: this.exportType, // 导出类型
                paperName: this.oldInfo.name // 试卷名称
            }
            let downloadUrl = this.GLOBAL.baseURL + 'exam/exportPaperDetailInfo?id=' + parames.id +
                '&exportType=' + parames.exportType +
                '&paperName=' + parames.paperName

            
            window.open(downloadUrl)

            setTimeout(() => {
                this.closeFun()
            }, 1000)
        }
    }
}
</script>
<style lang="scss" scoped>
.export-exam-paper-dialog {
    line-height: 40px;
}
</style>